import { useWidgetsStore } from "@/store/widgets";
const McTitle = import.meta.glob("/src/widgets/McTitle/component.json");
const McCapCube = import.meta.glob("/src/widgets/McCapCube/component.json");
const componentJson = [McTitle, McCapCube];
componentJson.forEach((item: any) => {
  for (const path in item) {
    // path==>/src/widgets/McTitle/component.json
    let parts = path.split("/"); // 将文件路径分割成多个部分
    let widgetName = parts[3]; // 获取 "McTitle"
    item[path]().then((module: any) => {
      const store = useWidgetsStore();
      module.default.component = widgetName;
      store.pushinitializingAction(module.default);
      // store.initializing.push(module.default);
      console.log(store.initializing, "store.initializing");
    });
  }
});
